
package Bank;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class BankingService {
    public Map<String, BankAccount> accounts = new HashMap<>();
    private TaskManager taskManager;

    public BankingService() {
        taskManager = new TaskManager();
    }

    
    public void createAccount(double initialBalance,String accountNumber){
        if (!accounts.containsKey(accountNumber)) {
            BankAccount newAccount = new BankAccount(initialBalance, accountNumber);
            accounts.put(accountNumber, newAccount);
            taskManager.addTask("Account created: " + accountNumber + "high");
        } else {
            System.out.println("Account already exists.");
        }
    }

    
    public boolean deposit(String accountNumber, double amount) {
        BankAccount account = accounts.get(accountNumber);
        if (account != null && amount > 0) {
            account.deposit(amount);
            taskManager.addTask("Deposited " + amount + " into account: " + accountNumber + "low");
            return true;
        }
        return false;
    }

    
    public boolean withdraw(String accountNumber, double amount) {
        BankAccount account = accounts.get(accountNumber);
        if (account != null && amount > 0 && account.getBalance() >= amount) {
            account.withdraw(amount);
            taskManager.addTask("Withdrew " + amount + " from account: " + accountNumber + "low");
            return true;
        }
        return false;
    }

    
    public double getBalance(String accountNumber) {
        BankAccount account = accounts.get(accountNumber);
        return account != null ? account.getBalance() : -1;
    }

    
    public List<String> listHighPriorityTasks() {
        return taskManager.getHighPriorityTasks();
    }

    
    public boolean processZooTicketSales(String zooId, double ticketSales) {
        return deposit(zooId, ticketSales);
    }

    
    public boolean processRestaurantBill(String customerId, double billAmount) {
        return withdraw(customerId, billAmount);
    }
}